Skip to content

设置随机位置字符串值 - RegistrySetProtectedValue

函数简介

写入字符串值到注册表随机位置。随机位置由机器唯一标识和键值名称计算得出。

接口名称

RegistrySetProtectedValue

DLL调用

cpp
int32_t RegistrySetProtectedValue(int64_t instance, const char* key, const char* value);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
key字符串键值名称。
value字符串键值内容。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
cpp
var ola = com("OlaPlug.OlaSoft")
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
ola.RegistrySetProtectedValue("license_key", "xxxx-xxxx");

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
RegistrySetProtectedValue(instance, "license_key", "xxxx-xxxx");
csharp
using System.Runtime.InteropServices;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int RegistrySetProtectedValue(long ola, string key, string value);

long instance = CreateCOLAPlugInterFace();
int ret = RegistrySetProtectedValue(instance, "license_key", "xxxx-xxxx");
python
from ctypes import CDLL, c_int, c_int64

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.RegistrySetProtectedValue(instance, b"license_key", b"xxxx-xxxx")

返回值

返回值说明
1成功。
0失败。

注意事项

项目说明
随机位置由机器唯一标识和键值名称共同计算得出随机位置由机器唯一标识和键值名称共同计算得出。
每个用户独立计算每个用户独立计算,互不干扰。
重启后可继续使用相同 key 读取此前写入的值重启后可继续使用相同 key 读取此前写入的值。